package main

import "fmt"

// Person 结构体
type Person struct {
	Name   string
	Age    int
	Adders string
}

func main() {
	//m := map[string]int{"one": 1, "two": 2}
	//for s, i := range m {
	//	fmt.Printf("健：%s 值：%d\n", s, i)
	//}
	//
	//users := Person{
	//	Name:   "你好",
	//	Age:    15,
	//	Adders: "hellish",
	//}
	//fmt.Printf("用户名：%s,年龄：%d,地址：%s\n", users.Name, users.Age, users.Adders)
	m := make(map[int]Person, 5)
	for i := 0; i < 5; i++ {
		m[i] = Person{
			Name:   fmt.Sprintf("用户%d", i),
			Age:    i,
			Adders: fmt.Sprintf("地址%d", i),
		}
	}

	m[5] = Person{
		Name:   "5s",
		Age:    0,
		Adders: "czc",
	}
	if user, ok := m[6]; ok {
		fmt.Printf("用户名：%s,年龄：%d,地址：%s\n", user.Name, user.Age, user.Adders)
	} else {
		fmt.Println("用户不存在")
	}
	fmt.Printf("map长度：%d\n", len(m))
	for i := 0; i < len(m); i++ {
		user := m[i]
		fmt.Printf("用户名：%s,年龄：%d,地址：%s\n", user.Name, user.Age, user.Adders)
	}
	var keys = make([]string, 0, 200)

}
